import 'package:lx_widgets_library/extension/enum_ex.dart';

// 车辆面板设置类型
enum VehiclePanelSetType {
  // 锁车
  lock(0, "Lock"),

  // 近光灯
  lowHeadlight(1, "LowHeadlight"),

  // 鸣笛
  horn(2, "Horn"),
  
  // 设置
  set(3, "Set");

  final int rawValue;
  final String name;
  const VehiclePanelSetType(this.rawValue, this.name);
  // 通过 title 获取枚举类型
  static VehiclePanelSetType? getTypeByTitle(String title) =>
      VehiclePanelSetType.values
          .firstWhereOrNull((activity) => activity.name == title);
  // 通过 rawValue 获取枚举类型
  static VehiclePanelSetType? getTypeByNum(int rawValue) => VehiclePanelSetType.values
      .firstWhereOrNull((activity) => activity.rawValue == rawValue);
  // 通过 rawValue 获取 title
  static String? getValue(int rawValue) => VehiclePanelSetType.values
      .firstWhereOrNull((activity) => activity.rawValue == rawValue)
      ?.name;
}